/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.pconline.activity.service;

import cn.pconline.security2.authentication.Client;
import cn.pconline.security2.authentication.UserInfo;
import cn.pconline.security2.authorization.Facade;

import javax.sql.DataSource;

/**
 * ��̨Ȩ�޼�����
 * @author pc
 */
public class SecurityService {
    String application;
	DataSource dataSource;

	public void setApplication(String application) {
		this.application = application;
	}

	public void setDataSource(DataSource dataSource) {
		this.dataSource = dataSource;
	}

	public void init() {
		// init Facade for auth-client
		Client.init();
		Facade.init(application, dataSource);
	}

	public void refresh() {
		Client.clearCache();
		Facade.clearCache();
	}



    public UserInfo getAdmin(long adminId) {
        return Client.getUser(String.valueOf(adminId));
    }
	
}
